package com.lagou;


import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;


@ComponentScan("com.lagou")
public class SpringBootApplication  {


    public static void main(String[] args) throws Exception {
        //1.初始化ioc，
        // 为什么要先初始化ioc，而不是先启动tomcat，因为ioc是必须的，而tomcat可以被其他中间件替换
        AnnotationConfigWebApplicationContext ac=new AnnotationConfigWebApplicationContext();
        ac.register(SpringBootApplication.class);   //手动去注册一个bean
        ac.refresh();

        //2.启动tomcat
        AbstractServletWebServerFactory factory = ac.getBean(TomcatServer.class);
        factory.createServer();




    }








}



